﻿//-----------------------------------------------------------------------
// <copyright file="LogEntryDataContract.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Silverlight.Contracts
{
    using System;
    using System.Collections;
    using System.Reflection;

    using System.Runtime.Serialization;

    using System.Xml.Linq;

    /// <summary>
    /// Represents an entry within the log.
    /// </summary>
    [DataContract(Name = "LogEntryDataContract", Namespace = "http://schemas.datacontract.org/2004/07/CodePlex.Diagnostics.Contracts")]
    public sealed class LogEntryDataContract
    {
        #region public LogEntryDataContract(string entry, LoggingPriority priority, LoggingType type, Guid publicationId)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:LogEntryDataContract"/> class.
        /// </summary>
        /// <param name="entry">The <see cref="T:System.String"/> containing the message to be logged.</param>
        /// <param name="priority">The <see cref="T:CodePlex.Diagnostics.LoggingPriority"/> of the log entry.</param>
        /// <param name="type">The <see cref="T:CodePlex.Diagnostics.LoggingType"/> of the log entry.</param>
        /// <param name="publicationId">The publication identifier.</param>
        public LogEntryDataContract(string entry, LoggingPriority priority, LoggingType type, Guid publicationId)
        {
            this.Entry = entry;

            this.LoggingPriority = priority;

            this.LoggingType = type;
            
            this.PublicationId = publicationId;
        }

        #endregion

        #region public AppDomainDataContract AppDomain

        /// <summary>
        /// Gets or sets the application domain within which the current exception was thrown.
        /// </summary>
        /// <value>The application domain within which the current exception was thrown.</value>
        [DataMember]
        public AppDomainDataContract AppDomain
        {
            get;
            set;
        }

        #endregion

        #region public AssemblyDataContract Assembly

        /// <summary>
        /// Gets or sets the assembly containing the code within which the current exception was thrown.
        /// </summary>
        /// <value>The assembly containing the code within which the current exception was thrown.</value>
        [DataMember]
        public AssemblyDataContract Assembly
        {
            get;
            set;
        }

        #endregion

        #region public LoggingPriority LoggingPriority

        /// <summary>
        /// Gets or sets the logging priority.
        /// </summary>
        /// <value>The logging priority.</value>
        [DataMember]
        public LoggingPriority LoggingPriority
        {
            get;
            set;
        }

        #endregion

        #region public LoggingType LoggingType

        /// <summary>
        /// Gets or sets the logging type.
        /// </summary>
        /// <value>The logging type.</value>
        [DataMember]
        public LoggingType LoggingType
        {
            get;
            set;
        }

        #endregion

        #region public MachineDataContract Machine

        /// <summary>
        /// Gets or sets the machine upon which the current exception was thrown.
        /// </summary>
        /// <value>The machine upon which the current exception was thrown.</value>
        [DataMember]
        public MachineDataContract Machine
        {
            get;
            set;
        }

        #endregion

        #region public string Entry

        /// <summary>
        /// Gets an entry that contains the message to be logged.
        /// </summary>
        /// <value>An entry that contains the message to be logged.</value>
        [DataMember]
        public string Entry
        {
            get;
            private set;
        }

        #endregion

        #region public ProcessDataContract Process

        /// <summary>
        /// Gets or sets the process within which the current exception was thrown.
        /// </summary>
        /// <value>The process within which the current exception was thrown.</value>
        [DataMember]
        public ProcessDataContract Process
        {
            get;
            set;
        }

        #endregion

        #region public Guid PublicationId

        /// <summary>
        /// Gets the publication Id of the log entry.
        /// </summary>
        /// <value>The publication Id of the log entry.</value>
        [DataMember]
        public Guid PublicationId
        {
            get;
            private set;
        }

        #endregion

        #region public ThreadDataContract Thread

        /// <summary>
        /// Gets or sets the thread within which the current exception was thrown.
        /// </summary>
        /// <value>The thread within which the current exception was thrown.</value>
        [DataMember]
        public ThreadDataContract Thread
        {
            get;
            set;
        }

        #endregion
    }
}
